Kechin001.PanelSummary = Ext.extend(Ext.Panel, {
  constructor: function(config) {
    config.title = 'Summary';

    config.items = [{
      xtype: 'box',
      autoEl: {
        tag: 'h2',
        html: 'History',
        style: 'text-align:center; line-height:2em'
      }
    },{
      xtype: 'box',
      autoEl: {
        tag: 'div',
        id: 'j-summary-chart',
        style: 'margin-left:100px'
      },
      width: 400,
      height: 300
    }];
    config.listeners = {
      activate: function(){
        var chart = new Highcharts.Chart({
          chart: {
            renderTo: 'j-summary-chart',
            plotBackgroundColor: null,
            plotBorderWidth: 1,
            plotShadow: false
          },
          title: {
            text: 'Monthly Living Expense'
          },
          tooltip: {
            formatter: function() {
              return '<b>'+this.x+'</b>: $'+this.y;
            }
          },
          xAxis: {
            categories: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 
              'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr']
          },
          yAxis: {
            title: {
              text: 'USD'
            }
          },
          plotOptions: {
            column: {
              allowPointSelect: true,
              cursor: 'pointer',
              dataLabels: {
                enabled: true,
                color: '#000',
                formatter: function() {
                  return '$'+this.y;
                }
              }
            }
          },
          series: [{
            type: 'column',
            showInLegend: false,
            //name: 'Monthly Living Expense',
            data: [ 1203.23, 3823.1, 1284.48, 2184.2, 1804.2,
              1602.34, 1850.1, 1981.0, 2304.53, 1203.9,
              1805.41, 584.2]
          }]
        });
      }
    };

    Kechin001.PanelSummary.superclass.constructor.apply(this, arguments);
  }
});
Ext.reg('kechin001PanelSummary', Kechin001.PanelSummary);
